home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 001a / bbsslt2.zip / CH1NEW.SLT < prev    next >
Text File  |  1991-12-16  |  11KB  |  260 lines

  1. //***************************************************************************
  2. //***                                                                       *
  3. //***            C H A N N E L   1  - -  N E W   F I L E S                  *
  4. //***                                                                       *
  5. //*** Description:                                                          *
  6. //***   Telix Script that automates downloading of new files information    *
  7. //***   from Channel 1 BBS.                                                 *
  8. //***                                                                       *
  9. //*** Script logic:                                                         *
  10. //***   1) Dials number specified by "phoneRow" variable.                   *
  11. //***   2) Logon to BBS automatically.                                      *
  12. //***   3) Request list all new files since last logon.                     *
  13. //***   4) Deletes backup file specified by "oldCaptureFileF" variable.     *
  14. //***   5) Renames current file specified by "newCaptureFile" variable to   *
  15. //***        backup file specified by "oldCaptureFile" variable.            *
  16. //***   6) Captures new files into file specified by "newCaptureFile"       *
  17. //***        variable.                                                      *
  18. //***   7) Logoff BBS                                                       *
  19. //***   8) Issue "hangup" to modem                                          *
  20. //***   9) Exit Telix.                                                      *
  21. //***                                                                       *
  22. //*** Instructions:                                                         *
  23. //***   To customize, fill in info wherever you find a //?? comment.        *
  24. //***                                                                       *
  25. //*** Hints:                                                                *
  26. //***   This script is goes after the new files directoryy (U) on the       *
  27. //***   Channel 1 BBS. You can be more specific by changing the             *
  28. //***   "newFilesDir" constant to the exact directories you want.           *
  29. //***                                                                       *
  30. //***      example: str newFilesDir [] = "3 30 45 66 77;                    *
  31. //***                                                                       *
  32. //***   This will allow you to get all new files in the respective file     *
  33. //***   directories.                                                        *
  34. //***                                                                       *
  35. //***   Script is easily modifible for other BBS's!                         *
  36. //***                                                                       *
  37. //*** Author:                                                               *
  38. //***   Joel R. DeRider                                                     *
  39. //***   Jona Computer Associates                                            *
  40. //***   181 Colleen Ave.                                                    *
  41. //***   Shoreview, MN  55126-6253                                           *
  42. //***   (612) 490-1238                                                      *
  43. //***                                                                       *
  44. //*** Change Log:                                                           *
  45. //***   12/15/91 - Initial Revision. Dedicated to the public domain.        *
  46. //***                                                                       *
  47. //***                                                                       *
  48. //***                                                                       *
  49. //***                                                                       *
  50. //***************************************************************************
  51.  
  52. main()
  53. {
  54.    str phoneRow        [] = "?";        //?? point to BBS row in dialing dir
  55.    str firstName       [] = "?";        //?? Your first name
  56.    str lastName        [] = "?";        //?? Your last name
  57.    str bbsPassword     [] = "?";        //?? Your BBS password
  58.  
  59.    str newFilesLib     [] = "U";                      //?? set to R&E new dir
  60.    str oldCaptureFile  [] = "ch1old.txt";             //?? (no path)
  61.    str newCaptureFile  [] = "h:\download\ch1new.txt"; //?? (enter full path)
  62.    str oldCaptureFileF [] = "h:\download\ch1old.txt"; //?? (enter full path)
  63.    str cr              [] = "^M";
  64.    str respondYes      [] = "y";
  65.    str respondNo       [] = "n";
  66.    str newFiles        [] = "n";
  67.    str nonStop         [] = "ns";
  68.    str goodBye         [] = "g";
  69.    int stringHit;
  70.  
  71.  
  72.    //------------------------------------------------------------------------
  73.    // String variables that will contain the strings to track thru the three
  74.    // loops A, B, and C.
  75.    //------------------------------------------------------------------------
  76.    int aTrackedString1,  aTrackedString2,  aTrackedString3,  aTrackedString4,  
  77.        aTrackedString5,  aTrackedString6,  aTrackedString7,  aTrackedString8,  
  78.        aTrackedString9;
  79.    int bTrackedString1,  bTrackedString2,  bTrackedString3;
  80.    int cTrackedString1,  cTrackedString2,  cTrackedString3,  cTrackedString4;
  81.  
  82.  
  83.    dial (phoneRow,0);                                 // Make the phone call  
  84.  
  85.  
  86.    //------------------------------------------------------------------------
  87.    // Set the tracking strings for loop A.
  88.    //------------------------------------------------------------------------
  89.  
  90.    aTrackedString1 = track ("Enter Language # to use (Enter)=no change?", 1);
  91.    aTrackedString2 = track ("Do you want Color? Y=Yes, N or Enter = No?", 1);
  92.    aTrackedString3 = track ("Enter your first name?",                     1);
  93.    aTrackedString4 = track ("Enter your last name?",                      1);
  94.    aTrackedString5 = track ("Password (Dots will echo)?",                 1);
  95.    aTrackedString6 = track ("Help, NS, N=Stop, (Enter)=More?",            1);
  96.    aTrackedString7 = track ("continue",                                   1);
  97.    aTrackedString8 = track ("Scan Message Base Since 'Last Read'?",       1);
  98.    aTrackedString9 = track ("Channel 1 command?",                         1);
  99.  
  100.  
  101.    //------------------------------------------------------------------------
  102.    // LOOP A
  103.    // Will get you logged on, and enter the new files command at main menu.
  104.    //------------------------------------------------------------------------
  105.  
  106.    while (1) 
  107.      {
  108.      terminal();               
  109.  
  110.      stringHit = track_hit (0);
  111.  
  112.           if (stringHit == aTrackedString1) 
  113.              {
  114.              cputs (cr);
  115.              track_free (aTrackedString1);
  116.              }       
  117.      else if (stringHit == aTrackedString2 )
  118.              {
  119.              cputs (respondNo);
  120.              cputs (cr);
  121.              track_free (aTrackedString2);
  122.              }
  123.      else if (stringHit == aTrackedString3)
  124.              {
  125.              cputs (firstName);
  126.              cputs (cr);
  127.              track_free (aTrackedString3);
  128.              }
  129.      else if (stringHit == aTrackedString4)
  130.              {
  131.              cputs (lastName);
  132.              cputs (cr);
  133.              track_free (aTrackedString4);
  134.              }
  135.      else if (stringHit == aTrackedString5)
  136.              {
  137.              cputs (bbsPassword);
  138.              cputs (cr);
  139.              track_free (aTrackedString5);
  140.              }
  141.      else if (stringHit == aTrackedString6)
  142.              {
  143.              cputs (respondNo);
  144.              cputs (cr);
  145.              }
  146.      else if (stringHit == aTrackedString7)
  147.              {
  148.              cputs (cr);
  149.              }
  150.      else if (stringHit == aTrackedString8)
  151.              {
  152.              cputs (respondNo);
  153.              cputs (cr);
  154.              track_free (aTrackedString8);
  155.              }
  156.      else if (stringHit == aTrackedString9)
  157.              {
  158.              cputs (newFiles);
  159.              cputs (cr);
  160.              track_free (aTrackedString9);
  161.              break;
  162.              }
  163.      }
  164.  
  165.  
  166.    //------------------------------------------------------------------------
  167.    // Clear then set the tracking strings for loop B.
  168.    //------------------------------------------------------------------------
  169.  
  170.    track_free (0);
  171.  
  172.    bTrackedString1 = track ("Date as (mmddyy) to search from? Enter=?", 1);
  173.    bTrackedString2 = track ("(A)ll, (U)ploads, (Enter)=none?",          1);
  174.    bTrackedString3 = track ("(H)elp, (V)iew, (F)lag, More?",            1);
  175.  
  176.  
  177.    //------------------------------------------------------------------------
  178.    // LOOP B
  179.    // Start the capture file processing. 
  180.    //------------------------------------------------------------------------
  181.  
  182.    while (1) 
  183.      {
  184.      terminal();               
  185.  
  186.      stringHit = track_hit (0);
  187.  
  188.           if (stringHit == bTrackedString1)
  189.              {
  190.              cputs (cr);
  191.              track_free (bTrackedString1);
  192.              }
  193.      else if (stringHit == bTrackedString2) 
  194.              {   
  195.              fdelete (oldCaptureFileF);               
  196.              frename (newCaptureFile, oldCaptureFile);
  197.              capture (newCaptureFile);
  198.              cputs (newFilesLib);  
  199.              cputs (cr);
  200.              track_free (bTrackedString2);
  201.              }
  202.      else if (stringHit == bTrackedString3)
  203.              {
  204.              cputs (nonStop);
  205.              cputs (cr);
  206.              track_free (bTrackedString3);
  207.              break;
  208.              }
  209.      }
  210.  
  211.  
  212.    //------------------------------------------------------------------------
  213.    // Clear then set the tracking strings for loop C.
  214.    //------------------------------------------------------------------------
  215.  
  216.    track_free (0);
  217.  
  218.    cTrackedString1 = track ("(H)elp, (V)iew, (F)lag, More?", 1);
  219.    cTrackedString2 = track ("Channel 1 command?",            1);
  220.  
  221.  
  222.    //------------------------------------------------------------------------
  223.    // LOOP C
  224.    // It ends the capture file processing then says goodbye to the BBS.
  225.    //------------------------------------------------------------------------
  226.  
  227.    while (1) 
  228.      {
  229.      terminal();               
  230.  
  231.      stringHit = track_hit (0);
  232.  
  233.           if (stringHit == cTrackedString1) 
  234.              {
  235.              capture ("*CLOSE*"); 
  236.              cputs (nonStop);     
  237.              cputs (cr);
  238.              track_free (cTrackedString1);
  239.              }
  240.      else if (stringHit == cTrackedString2)
  241.              {
  242.              cputs (goodBye);
  243.              cputs (cr);
  244.              break;
  245.              track_free (cTrackedString2);
  246.              }
  247.      }
  248.  
  249.    //------------------------------------------------------------------------
  250.    // Let's clean up after ourselves!!
  251.    //------------------------------------------------------------------------
  252.  
  253.    track_free (0);              // Clear all the tracking strings.
  254.    hangup ();                   // Hang up the phone.
  255.    exittelix (0,1);             // Exit Telix (to DOS.)
  256.    return;                      // Make compiler happy and return from main.
  257. }
  258.  
  259.  
  260.